package com.itheima.overLoad;

public class Demo4Method {
    public static void main(String[] args) {

        int[] arr = {11, 33, 55, 22, 4};

        int[] minandmax = minandmax(arr);

        System.out.println(minandmax[0]);
        System.out.println(minandmax[1]);
    }

    public static int[] minandmax(int[] arr) {

        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }

        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }

        int[] minandmax = {min, max};
        return minandmax;
    }
}
